﻿#ifndef __AF_LAYOUT_H__
#define __AF_LAYOUT_H__

#include "AF_Define.h"

namespace AF
{
	class Layout; //-* ForEach
}
typedef AF::Layout		AF_CLayout;

#include "AF_Graphics.h"
#include "AF_ForEach.h"

namespace AF
{
	/// 场景使用界面类
	class _ABSTRACT Layout : public ForEach
	{
	public:
		Layout();
		virtual ~Layout();

	public:
		Pointer			Foreach(bool isFirst);
		UINT			GetCount();

	public:
		bool			Init(Bundle* pArgs = NULL);
		void			Destroy();

	protected:
		/// 当初始化时
		virtual bool		OnInit(AF_CBundle* pArgs) = 0;			// 当 界面初始化 时
		/// 当销毁时
		virtual void		OnDestroy()
					{return;}
		/// 获取指定名字可绘制对象
		virtual Graphics*	GetGraphicsByName(_STRING strGraphicsName, int nParam1 = 0, int nParam2 = 0);

	protected:
		void			AddGraphics(Graphics* pGraphics);
		Graphics*		GetGraphics(_STRING strGraphicsName);

	private:
		void			CheckGraphics(Graphics* pGraphics);

	protected:
		Link<Graphics*>		m_lnkGraphicses;
		Table<Graphics*>	m_tabGraphicses;
	};
}

#endif